<template>
	<view class="mcrmb-info">
		<view class="padding text-center">
			<view class="padding-xl radius shadow-blur bg-red margin-top bg-img" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big91005.jpg);">
				<view>个人节操币消费记录查询-(最后五条)</view>
			</view>
		</view>
		<uni-list>
		    <uni-list-item v-for="v in recordData" :key="v.id"
				:title="'说明: ' + v.text" 
				:note="'日期: ' + v.date" 
				:rightText="v.money + ' 节操币'"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import {uniList} from '@dcloudio/uni-ui'
	import {uniListItem} from '@dcloudio/uni-ui'
	import ajax from '../../../Ajax/index.js'
	import common from '../../../common/index.js'
	export default {
		components: {
			uniList,
			uniListItem
		},
		data() {
			return {
				recordData: []
			}
		},
		mounted() {
			this.getMcrmbPlayerRecord()
		},
		methods: {
			getMcrmbPlayerRecord() {
				let playerName = common.getCookie('playerName')
				if (!!!playerName) {
					uni.showToast({title: '请登录', icon: 'none'})
					return
				}
				let param = new URLSearchParams()
				param.append("playerName", playerName)
				ajax.post('mcrmb/getPlayerMcRmbRecord', param).then(res => {
					if (res.data.code == 101) {
						res.data.data.map(value => {
							value.date = new Date(value.date * 1000).toLocaleString()
							this.recordData.push(value)
						})
					}
				})
			}
		}
	}
</script>

<style>

</style>
